<template>
  <van-tabbar v-model="baseStore.nowAct" safe-area-inset-bottom>
    <van-tabbar-item to="home" :icon="baseStore.nowAct == 0 ? 'shopping-cart' : 'shopping-cart-o'">商店</van-tabbar-item>
    <van-tabbar-item to="classify" :icon="baseStore.nowAct == 1 ? 'qr' : 'qr-invalid'">分类</van-tabbar-item>
    <van-tabbar-item to="cart" :icon="baseStore.nowAct == 2 ? 'cart' : 'cart-o'">购物车</van-tabbar-item>
    <van-tabbar-item to="user" :icon="baseStore.nowAct == 3 ? 'manager' : 'manager-o'">个人</van-tabbar-item>
  </van-tabbar>
</template>

<script setup lang="ts">

import { useBaseStore } from '../../store';
let baseStore = useBaseStore()
// baseStore.nowAct = Number(localStorage.getItem('activeTab')) || 0;



// watch(active, (newValue) => {
//   localStorage.setItem('activeTab', newValue.toString());
// });

// onMounted(() => {
//   const savedTab = Number(localStorage.getItem('activeTab'));
//   if (savedTab >= 0 && savedTab < 4) {
//     baseStore.nowAct = savedTab;
//   } else {
//     baseStore.nowAct = 0;
//   }
// });

</script>

<style scoped>

</style>
